home *** CD-ROM | disk | FTP | other *** search
- on setboxSize whichBox
- global gStageAcross, gStageUpDown, gBoxLeft, gBoxTop
- case whichBox of
- "questBox":
- set gBoxLeft to 304
- set right to 615
- set gBoxTop to 55
- set bottom to 315
- "ans1":
- set gBoxLeft to 85
- set right to 586
- set gBoxTop to 346
- set bottom to 373
- "ans2":
- set gBoxLeft to 85
- set right to 586
- set gBoxTop to 379
- set bottom to 406
- "ans3":
- set gBoxLeft to 85
- set right to 586
- set gBoxTop to 415
- set bottom to 442
- "ans4":
- set gBoxLeft to 85
- set right to 586
- set gBoxTop to 450
- set bottom to 477
- end case
- set gStageAcross to abs(right - gBoxLeft)
- set gStageUpDown to abs(gBoxTop - bottom)
- end
-
- on countAndCenterText centerWhat, whatColor, howSo
- global gStageAcross, gStageUpDown, gBoxLeft, gSpaceWidth, gBoxTop, gDontCenter
- set gSpaceWidth to 10
- set letterLst to []
- set lineLst to []
- set txtWdthLst to []
- set textWidth to 0
- set numOfLines to 1
- set xtraHeight to 3
- set wordLnLst to []
- repeat with c = 1 to the number of words in centerWhat
- set thisWord to word c of centerWhat
- if c = 1 then
- set wordWidth to 0
- set wordLst to []
- else
- set wordWidth to gSpaceWidth
- set wordLst to [SPACE]
- end if
- if whatColor = "ran" then
- case random(4) of
- "1":
- set whichColor to "red"
- "2":
- set whichColor to "yel"
- "3":
- set whichColor to "grn"
- "4":
- set whichColor to "pur"
- end case
- else
- set whichColor to whatColor
- end if
- repeat with w = 1 to the number of chars in thisWord
- set thisChar to char w of thisWord
- set thisChar to getCharCode(thisChar)
- set charWidth to the width of member (thisChar & SPACE & whichColor)
- set wordWidth to wordWidth + charWidth
- set indLettLst to [thisChar & SPACE & whichColor]
- add(wordLst, indLettLst)
- end repeat
- if (textWidth + wordWidth) <= gStageAcross then
- set textWidth to textWidth + wordWidth
- add(lineLst, wordLst)
- add(wordLnLst, thisWord)
- next repeat
- end if
- add(letterLst, lineLst)
- add(txtWdthLst, textWidth)
- set textWidth to wordWidth
- set lineLst to [wordLst]
- set wordLnLst to [thisWord]
- end repeat
- add(letterLst, lineLst)
- add(txtWdthLst, textWidth)
- set tempLst to []
- set numLines to count(letterLst)
- set letterHeight to the height of member ("48 " & whichColor)
- if gStageUpDown > integer(numLines * letterHeight) then
- set diff to integer((gStageUpDown - (numLines * letterHeight)) / 2)
- set startV to gBoxTop + diff + integer(letterHeight / 2)
- repeat with Y = 1 to count(letterLst)
- set thisLine to getAt(letterLst, Y)
- set textWidth to value(getAt(txtWdthLst, Y))
- set otherDiff to integer((gStageAcross - textWidth) / 2)
- if howSo = "center" then
- set startH to gBoxLeft + otherDiff
- else
- if howSo = "left" then
- set startH to gBoxLeft + gSpaceWidth
- end if
- end if
- repeat with w = 1 to count(thisLine)
- set thisWord to getAt(thisLine, w)
- repeat with m = 1 to count(thisWord)
- set thisLetter to getAt(thisWord, m)
- if thisLetter <> SPACE then
- set thisChar to getAt(thisLetter, 1)
- set startH to integer(startH + (the width of member thisChar / 2))
- set nextH to integer(the width of member thisChar / 2)
- add(thisLetter, startH)
- add(thisLetter, startV)
- set startH to startH + nextH
- next repeat
- end if
- set startH to startH + gSpaceWidth
- end repeat
- end repeat
- set startV to startV + letterHeight + xtraHeight
- end repeat
- else
- alert("too many lines! " & centerWhat)
- set gDontCenter to 1
- end if
- return letterLst
- end
-
- on stampOutTxt whichTxt, whichSprite, trails
- global gNoTrailSprite, gLastNoTrailsSprt, gDontCenter
- if gDontCenter = 1 then
- set gDontCenter to 0
- else
- repeat with Y = 1 to count(whichTxt)
- set thisLine to getAt(whichTxt, Y)
- repeat with w = 1 to count(thisLine)
- set thisWord to getAt(thisLine, w)
- repeat with m = 1 to count(thisWord)
- if trails = 0 then
- set whichSprite to gNoTrailSprite
- end if
- set thisLetter to getAt(thisWord, m)
- if thisLetter <> SPACE then
- set thisChar to getAt(thisLetter, 1)
- set thisH to value(getAt(thisLetter, 2))
- set thisV to value(getAt(thisLetter, 3))
- set the memberNum of sprite whichSprite to the number of member thisChar
- set the width of sprite whichSprite to the width of member thisChar
- set the height of sprite whichSprite to the height of member thisChar
- set the loc of sprite whichSprite to point(thisH, thisV)
- if not soundBusy(2) then
- end if
- updateStage()
- if trails = 1 then
- updateStage()
- set the loc of sprite whichSprite to point(-100, -100)
- next repeat
- end if
- set gNoTrailSprite to gNoTrailSprite + 1
- if gNoTrailSprite = gLastNoTrailsSprt then
- alert(string(the myAnswerLst of getAt(gProbLst, 1)))
- exit repeat
- end if
- end if
- end repeat
- end repeat
- end repeat
- end if
- end
-
- on getCharCode thisChar
- set asciiLst to ["Ä", "142", "Ö", "153", "Ü", "154", "ß", "225", "ä", "132", "ö", "148", "ü", "129", "á", "160", "é", "130", "í", "161", "ñ", "164", "ó", "162", "ú", "163", "Á", "253", "É", "144", "Í", "252", "Ñ", "165", "Ó", "251", "Ú", "250", "à", "133", "â", "131", "ç", "135", "ê", "136", "ë", "137", "ï", "139", "î", "140", "ô", "147", "œ", "249", "ù", "151", "û", "150", "À", "248", "Â", "247", "Ç", "128", "Ê", "246", "Ë", "245", "È", "244", "Ï", "243", "Î", "242", "Ô", "241", "Œ", "240", "Ù", "239", "Û", "238", "è", "138", "ì", "141", "ò", "149", "Ì", "237", "Ò", "236", "¿", "168", "¡", "255"]
- set aPos to getPos(asciiLst, thisChar)
- if aPos <> 0 then
- set aNum to value(getAt(asciiLst, aPos + 1))
- else
- set aNum to charToNum(thisChar)
- end if
- return aNum
- end
-